import request from "@/utils/request"

export enum JudgeShowStatus {
  显示 = 1,
  隐藏 = 2,
}

export enum JudgeReplyStatus {
  未回复 = 1,
  已回复 = 2,
}

export interface QueryJudgeListParams extends PaginationParams {
  stationId?: string
  stubId?: string
  telephone?: string
  beginTime?: string
  endTime?: string
  status?: JudgeReplyStatus
}

export interface Judge {
  id: number
  /** 评论 */
  commend: string
  nickname: string
  /** 图片列表 */
  pics: string
  reply: string
  replyTime: string
  hideStatus: JudgeShowStatus
  createTime: string
  score: number
  stationId: string
  userId: string
  userImg: string
  userPhoneNumber: string
}

export async function queryJudgeList(params: QueryJudgeListParams) {
  return request<Judge[]>('/app/manager/judge/list', {
    data: params,
  })
}

export async function toggleJudgeShow(params: {commentId: number, showStatus: JudgeShowStatus}) {
  return request('/app/manager/judge/showHide', {
    data: params,
  })
}

export async function replyJudge(params: {commentId: number, content: string}) {
  return request('/app/manager/judge/reply', {
    data: params,
  })
}

export async function delJudge(params: {commentId: number}) {
  return request('/app/manager/judge/del', {
    data: params,
  })
}
